package  wibrst.utils{
	import flash.filters.BevelFilter;
	import flash.filters.BitmapFilter;
	import flash.filters.BitmapFilterQuality;
	import flash.filters.BlurFilter;
	import flash.filters.ColorMatrixFilter;
	import flash.filters.GlowFilter;
	/**
	 * ...
	 * @author wibrst@qq.com
	 */
	public class FilterUtil {
		
		static public function reflect( filter:BitmapFilter ):String {
			var sConstruct:String = 'reflect '+ filter;
			
			switch( true ) {
			case filter is GlowFilter:{
				var fGlow:GlowFilter = filter as GlowFilter;
					sConstruct += 
					'new GlowFilter(' 
					+'\n\t0x'+  fGlow.color.toString("16")
					+'\n\t, '+ fGlow.alpha.toString() 
					+'\n\t, '+ fGlow.blurX.toString() 
					+'\n\t, '+ fGlow.blurY.toString() 
					+'\n\t, '+ fGlow.strength.toString() 
					+'\n\t, '+ fGlow.quality.toString() 
					+'\n\t, '+ fGlow.inner.toString() 
					+'\n\t, '+ fGlow.knockout.toString()
					+'\n);'
			break; }
			case filter is BevelFilter: {
			break; }
			case filter is BlurFilter: {
			break; }
			case filter is ColorMatrixFilter: {
			break; }
			}
			
			return sConstruct;
		}
		
        static public function getBlurFilter():BitmapFilter {
            var blurX:Number = 3;
            var blurY:Number = 3;
            return new BlurFilter(blurX, blurY, BitmapFilterQuality.HIGH);
        }
		
        static public function getGlowFilter():BitmapFilter {
            var color:Number = 0xffffff;
            var alpha:Number = 0.8;
            var blurX:Number = 10;
            var blurY:Number = 10;
            var strength:Number = 9;
            var inner:Boolean = false;
            var knockout:Boolean = false;
            var quality:Number = BitmapFilterQuality.HIGH;

            return new GlowFilter(color,
                                  alpha,
                                  blurX,
                                  blurY,
                                  strength,
                                  quality,
                                  inner,
                                  knockout);
        }
		
        static public function getTextGlowFilter ( 
		color:Number = 0xffffff
	  ):BitmapFilter {
            var alpha:Number = 0.8;
            var blurX:Number = 1.1;
            var blurY:Number = 1.1;
            var strength:Number = 10;
            var inner:Boolean = false;
            var knockout:Boolean = false;
            var quality:Number = BitmapFilterQuality.HIGH;

            return new GlowFilter(color,
                                  alpha,
                                  blurX,
                                  blurY,
                                  strength,
                                  quality,
                                  inner,
                                  knockout);
        }
		
	}

}